import java.io.File;
import java.io.FileFilter;

public class DirFilter {

	public static void main() {
	}
	
    public void doFileFilterDirectoryListing(String dirName) {

        System.out.println("Filtered Directory list");
        System.out.println("-----------------------");

        File dir = new File(dirName);

		    File[] files = dir.listFiles();
		    
		    // This filter only returns directories
		    FileFilter fileFilter = new FileFilter() {
		        public boolean accept(File file) {
		            return file.isDirectory();
		        }
		    };
		    files = dir.listFiles(fileFilter);
    
        for (int i=0; i<files.length; i++) {
            System.out.println("[D] : " + files[i]);
        }
        System.out.println();
    }

}
